SizeOf
Size = SizeOf(DataType)
 
Parameters:

    DataType = The data type you wish to query the size of.
Returns:

    Size = Size in bytes of this data type
 

      The SizeOf() function returns the size (in bytes) of a data type. It's main purpose is to get the size of the User Defined Type structures, but can also be used on things like variable\constant data types also.

      Knowing the size of structures such as user defined types, is very useful when using typed pointers or storing information on disc for example.

      Not sure what Types are ?, Make sure you check out the Types tutorial.




FACTS:



* SizeOf doesn't work with Dynamic structures such as Arrays. See GetArrayelements

* SizeOf will error if the Data Type is unknown or can't be resolved at compile time.





Mini Tutorial:


  
  // Declare a User defined type
  Type Pos
     x,y,z
  EndType
  
  // Use the SizeOF() operator to calc the size
  // of this structure in bytes
  Print SizeOf(pos)
  
  // Display the results and wait for a key press
  Sync
  WaitKey
  
  




This example would output.

  
  12
  

 
Related Info: Dim | Float | Integer | Pointer | String | Type | TypeOf | Types :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com